function S = getfilesize(filename)
fid = fopen(filename);
fseek(fid, 0, 'eof');
S = ftell(fid);
fclose(fid);